/*
 * MIT License
 *
 * Copyright (C) 2023 Huawei Device Co., Ltd.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

import type {HostComponent,ViewProps} from 'react-native';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type { Float,DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
  
  type Stroke = Readonly<{
    color?: string;
    width?: Float;
  }>

  export type Location = Readonly<{
    latitude?: Float;
    longitude?: Float;
  }>

  type onMarkerClickEvent = Readonly<{
    position: {
      latitude?: Float;
      longitude?: Float;
    };
    title?: string;
  }>

  type onMapStatusChangeEvent = Readonly<{
    overlook: Float;
    target?: {
      latitude?: Float;
      longitude?: Float;
    };
  }> 
  
  export type VoidEventData = Readonly<{}>;

  type pointsData = ReadonlyArray<Location>;

export interface NativeProps extends ViewProps {
  zoomControlsVisible: boolean,
  trafficEnabled: boolean,
  baiduHeatMapEnabled: boolean,
  zoomGesturesEnabled: boolean,//是否充许手势缩放
  scrollGesturesEnabled: boolean, //是否允许拖动
  mapType: Float,
  zoom: Float,
  showsUserLocation: boolean,
  locationData: Location,
  center: Location,
  onMapStatusChangeStart: DirectEventHandler<VoidEventData>,
  onMapStatusChange: DirectEventHandler<onMapStatusChangeEvent>,
  onMapStatusChangeFinish: DirectEventHandler<VoidEventData>,
  onMapLoaded: DirectEventHandler<VoidEventData>,
  onMapClick: DirectEventHandler<Location>,
  onMapDoubleClick: DirectEventHandler<VoidEventData>,
  onMarkerClick: DirectEventHandler<onMarkerClickEvent>,
  onMapPoiClick: DirectEventHandler<VoidEventData>
}

export default codegenNativeComponent<NativeProps>(
  'BaiduMapView',
) as HostComponent<NativeProps>;

